﻿
namespace ATA.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.ChietKhauNhanh"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class ChietKhauNhanhEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ChietKhauNhanhId property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxChietKhauNhanhId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ChietKhauNhanhId property.
		/// </summary>
		protected System.Windows.Forms.Label uxChietKhauNhanhIdLabel;
		
		/// <summary>
		/// TextBox for the MucThuong property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMucThuong;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the MucThuong property.
		/// </summary>
		protected System.Windows.Forms.Label uxMucThuongLabel;
		
		/// <summary>
		/// ComboBox for the ChietKhauId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxChietKhauId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ChietKhauId property.
		/// </summary>
		protected System.Windows.Forms.Label uxChietKhauIdLabel;
		
		/// <summary>
		/// DataTimePicker for the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxLastUpdate;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.Label uxLastUpdateLabel;
		
		/// <summary>
		/// TextBox for the UpdateBy property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxUpdateBy;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the UpdateBy property.
		/// </summary>
		protected System.Windows.Forms.Label uxUpdateByLabel;
		
		/// <summary>
		/// ComboBox for the NhomSanPhamId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxNhomSanPhamId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the NhomSanPhamId property.
		/// </summary>
		protected System.Windows.Forms.Label uxNhomSanPhamIdLabel;
		#endregion
		
		#region Main entity
		private Entities.ChietKhauNhanh _ChietKhauNhanh;
		/// <summary>
		/// Gets or sets the <see cref="Entities.ChietKhauNhanh"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.ChietKhauNhanh"/> instance.</value>
		public Entities.ChietKhauNhanh ChietKhauNhanh
		{
			get {return this._ChietKhauNhanh;}
			set
			{
				this._ChietKhauNhanh = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxChietKhauNhanhId.DataBindings.Clear();
			this.uxChietKhauNhanhId.DataBindings.Add("Text", this.uxBindingSource, "ChietKhauNhanhId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMucThuong.DataBindings.Clear();
			this.uxMucThuong.DataBindings.Add("Text", this.uxBindingSource, "MucThuong", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxChietKhauId.DataBindings.Clear();
			this.uxChietKhauId.DataBindings.Add("SelectedValue", this.uxBindingSource, "ChietKhauId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLastUpdate.DataBindings.Clear();
			this.uxLastUpdate.DataBindings.Add("Value", this.uxBindingSource, "LastUpdate", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxUpdateBy.DataBindings.Clear();
			this.uxUpdateBy.DataBindings.Add("Text", this.uxBindingSource, "UpdateBy", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNhomSanPhamId.DataBindings.Clear();
			this.uxNhomSanPhamId.DataBindings.Add("SelectedValue", this.uxBindingSource, "NhomSanPhamId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="ChietKhauNhanhEditControlBase"/> class.
		/// </summary>
		public ChietKhauNhanhEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_ChietKhauNhanh != null) _ChietKhauNhanh.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxChietKhauNhanhId = new System.Windows.Forms.TextBox();
			uxChietKhauNhanhIdLabel = new System.Windows.Forms.Label();
			this.uxMucThuong = new System.Windows.Forms.TextBox();
			uxMucThuongLabel = new System.Windows.Forms.Label();
			this.uxChietKhauId = new System.Windows.Forms.ComboBox();
			uxChietKhauIdLabel = new System.Windows.Forms.Label();
			this.uxLastUpdate = new System.Windows.Forms.DateTimePicker();
			uxLastUpdateLabel = new System.Windows.Forms.Label();
			this.uxUpdateBy = new System.Windows.Forms.TextBox();
			uxUpdateByLabel = new System.Windows.Forms.Label();
			this.uxNhomSanPhamId = new System.Windows.Forms.ComboBox();
			uxNhomSanPhamIdLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxChietKhauNhanhIdLabel
			//
			this.uxChietKhauNhanhIdLabel.Text = "ChietKhauNhanhId:";
			this.uxChietKhauNhanhIdLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxChietKhauNhanhIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxChietKhauNhanhIdLabel);			
			//
			// uxChietKhauNhanhId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxChietKhauNhanhId);
			this.uxChietKhauNhanhId.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxChietKhauNhanhId);
			//
			// uxMucThuongLabel
			//
			this.uxMucThuongLabel.Text = "MucThuong:";
			this.uxMucThuongLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxMucThuongLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMucThuongLabel);			
			//
			// uxMucThuong
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxMucThuong);
			this.uxMucThuong.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxMucThuong);
			//
			// uxChietKhauIdLabel
			//
			this.uxChietKhauIdLabel.Text = "ChietKhauId:";
			this.uxChietKhauIdLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxChietKhauIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxChietKhauIdLabel);			
			//
			// uxChietKhauId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxChietKhauId);
			this.uxChietKhauId.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxChietKhauId);
			//
			// uxLastUpdateLabel
			//
			this.uxLastUpdateLabel.Text = "LastUpdate:";
			this.uxLastUpdateLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxLastUpdateLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdateLabel);			
			//
			// uxLastUpdate
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdate);
			this.uxLastUpdate.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxLastUpdate);
			//
			// uxUpdateByLabel
			//
			this.uxUpdateByLabel.Text = "UpdateBy:";
			this.uxUpdateByLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxUpdateByLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateByLabel);			
			//
			// uxUpdateBy
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateBy);
			this.uxUpdateBy.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxUpdateBy);
			//
			// uxNhomSanPhamIdLabel
			//
			this.uxNhomSanPhamIdLabel.Text = "NhomSanPhamId:";
			this.uxNhomSanPhamIdLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxNhomSanPhamIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNhomSanPhamIdLabel);			
			//
			// uxNhomSanPhamId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxNhomSanPhamId);
			this.uxNhomSanPhamId.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxNhomSanPhamId);
			//
			// uxNhomSanPhamId
			//				
			this.uxNhomSanPhamId.DisplayMember = "SanPhamId";	
			this.uxNhomSanPhamId.ValueMember = "NhomSanPhamId";	
			//
			// uxChietKhauId
			//				
			this.uxChietKhauId.DisplayMember = "StartDate";	
			this.uxChietKhauId.ValueMember = "ChietKhauId";	
			// 
			// ChietKhauNhanhEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "ChietKhauNhanhEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.NhomSanPham> _NhomSanPhamIdList;
		
		/// <summary>
		/// The ComboBox associated with the NhomSanPhamId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.NhomSanPham> NhomSanPhamIdList
		{
			get {return _NhomSanPhamIdList;}
			set 
			{
				this._NhomSanPhamIdList = value;
				this.uxNhomSanPhamId.DataSource = null;
				this.uxNhomSanPhamId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInNhomSanPhamIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the NhomSanPhamId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInNhomSanPhamIdList
		{
			get { return _allowNewItemInNhomSanPhamIdList;}
			set
			{
				this._allowNewItemInNhomSanPhamIdList = value;
				this.uxNhomSanPhamId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.ChietKhau> _ChietKhauIdList;
		
		/// <summary>
		/// The ComboBox associated with the ChietKhauId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.ChietKhau> ChietKhauIdList
		{
			get {return _ChietKhauIdList;}
			set 
			{
				this._ChietKhauIdList = value;
				this.uxChietKhauId.DataSource = null;
				this.uxChietKhauId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInChietKhauIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the ChietKhauId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInChietKhauIdList
		{
			get { return _allowNewItemInChietKhauIdList;}
			set
			{
				this._allowNewItemInChietKhauIdList = value;
				this.uxChietKhauId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
